#ifndef _SPINEANIMATECACHE_H
#define _SPINEANIMATECACHE_H

#include <map>
#include <memory>
#include "SpineAnimateCache.h"
#include <spine/spine-cocos2dx.h>

typedef std::shared_ptr<spSkeletonData> SpSkeletonDataPtr;
typedef std::map<std::string, SpSkeletonDataPtr> SKELETON_DATA_CACHE_MAP;

class SpineAnimateCache
{
public:
	static SpineAnimateCache* getInstance()
	{
		static SpineAnimateCache instance;
		return &instance;
	}

	spSkeletonData* addCache(const std::string& filename, float scale);
	spine::SkeletonAnimation* getSpAnimate(const std::string& filename,float scale);

	void cleanCache();
private:
	SKELETON_DATA_CACHE_MAP _skeletonDataCacheMap;
	std::set<std::string> _textureCache;
};

#endif
